﻿namespace DimensionsHelper.Client.WinUi.Views;

public partial class MessageDataTemplateSelector : DataTemplateSelector
{
    public DataTemplate? SimpleMessage
    {
        get;
        set;
    }


    public DataTemplate? ProgressMessage
    {
        get;
        set;
    }


    public DataTemplate? HyperlinkMessage
    {
        get;
        set;
    }


    protected override DataTemplate SelectTemplateCore(object item)
    {
        if (item is MessageModel messageModel)
        {
            if (messageModel.WithProgress)
            {
                return ProgressMessage!;
            }

            if (!string.IsNullOrEmpty(messageModel.LocalDirectory))
            {
                return HyperlinkMessage!;
            }
        }

        return SimpleMessage!;
    }
}